﻿module Supernova {

    export class Sounds {

        public static items = {
            collectGold: [new Audio('sounds/collect_gold.mp3')],
            collectScience: [new Audio('sounds/collect_science.mp3')],
            collectWreck: [new Audio('sounds/collect_wreck.mp3')],
            missileLaunch: [new Audio('sounds/missile_launch_1.mp3'), new Audio('sounds/missile_launch_1.mp3'), new Audio('sounds/missile_launch_1.mp3'), new Audio('sounds/missile_launch_1.mp3'), new Audio('sounds/missile_launch_1.mp3'), new Audio('sounds/missile_launch_1.mp3')],
            missileHit: [new Audio('sounds/missile_hit_1.mp3'), new Audio('sounds/missile_hit_2.mp3'), new Audio('sounds/missile_hit_3.mp3'), new Audio('sounds/missile_hit_1.mp3'), new Audio('sounds/missile_hit_2.mp3'), new Audio('sounds/missile_hit_3.mp3')],
            missileHitShield: [new Audio('sounds/missile_hit_shield.mp3'), new Audio('sounds/missile_hit_shield.mp3'), new Audio('sounds/missile_hit_shield.mp3'), new Audio('sounds/missile_hit_shield.mp3'), new Audio('sounds/missile_hit_shield.mp3'), new Audio('sounds/missile_hit_shield.mp3')],
            shipExplodeMe: [new Audio('sounds/ship_explode_me.mp3'), new Audio('sounds/ship_explode_me.mp3'), new Audio('sounds/ship_explode_me.mp3'), new Audio('sounds/ship_explode_me.mp3'), new Audio('sounds/ship_explode_me.mp3'), new Audio('sounds/ship_explode_me.mp3')],
            shipExplodeEnemy: [new Audio('sounds/ship_explode_enemy.mp3'), new Audio('sounds/ship_explode_enemy.mp3'), new Audio('sounds/ship_explode_enemy.mp3'), new Audio('sounds/ship_explode_enemy.mp3'), new Audio('sounds/ship_explode_enemy.mp3'), new Audio('sounds/ship_explode_enemy.mp3')],
            blip: [new Audio('sounds/blip.mp3')],
            bombardOrbital: [new Audio('sounds/bombard_orbital.mp3'), new Audio('sounds/bombard_orbital.mp3'), new Audio('sounds/bombard_orbital.mp3')],
            bombardPlanet: [new Audio('sounds/bombard_planet.mp3'), new Audio('sounds/bombard_planet.mp3'), new Audio('sounds/bombard_planet.mp3')],
            colonise: [new Audio('sounds/colonise.mp3')],
            terraform: [new Audio('sounds/terraform.mp3')],
            disband: [new Audio('sounds/disband.mp3')],
            artillery: [new Audio('sounds/artillery.mp3'), new Audio('sounds/artillery.mp3'), new Audio('sounds/artillery.mp3'), new Audio('sounds/artillery.mp3'), new Audio('sounds/artillery.mp3'), new Audio('sounds/artillery.mp3')],
            alert: [new Audio('sounds/alert.mp3')],
            researchAvailable: [new Audio('sounds/research_available.mp3')]
        };

        public static play(sound: Array<HTMLAudioElement>) {
            if (!Options.soundEffects) return;
            var index = randomInt(0, sound.length - 1);
            sound[index].play();
        }

    }

}